package com.project.web.system.service.impl.app;

import com.project.common.core.utils.id.IDUtil;
import com.project.web.system.mapper.app.AdminRoleMapper;
import com.project.web.system.mapper.app.MenuMapper;
import com.project.web.system.model.app.AdminRole;
import com.project.web.system.model.app.Menu;
import com.project.web.system.service.app.AdminRoleService;
import com.project.web.system.service.impl.common.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @ClassName AdminRoleServiceImpl
 * @Description
 * @Author 王天豪
 * @Date 2020/8/14 11:32 AM
 * @Version 1.0
 */
@Service("adminRoleServiceImpl")
public class AdminRoleServiceImpl extends BaseServiceImpl<AdminRole,Long> implements AdminRoleService {


    @Autowired
    private AdminRoleMapper adminRoleMapper;

    @Autowired
    private MenuMapper menuMapper;


    @Override
    public void deteleByAdminId(Long id) {
        adminRoleMapper.deteleByAdminId(id);
    }

    @Override
    public void batchSave(List<AdminRole> adminRoles) {
        for (AdminRole adminRole:adminRoles) {
            adminRole.setId(IDUtil.getId());
            adminRole.setCreateDate(new Date());
        }
        adminRoleMapper.batchSave(adminRoles);
    }


}
